package com.example.crud.service;

import com.example.crud.dao.SUserMapper;
import com.example.crud.domain.SUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Roger
 * @since 2021/6/16
 */
@Service
public class SUserService {
    @Autowired
    SUserMapper sUserMapper;

    public int addSUser(SUser sUser){
        sUserMapper.insertSelective(sUser);
        return 0;
    }

    public SUser getSUser(int id){
        SUser sUser = sUserMapper.selectByPrimaryKey(id);
        return sUser;
    }

    public int updateSUser(SUser sUser){
        int num = sUserMapper.updateByPrimaryKey(sUser);
        return num;
    }

    public int deleteSUser(int id){
        int num = sUserMapper.deleteByPrimaryKey(id);
        return num;
    }
}
